home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / TouchMe 1.1.1.sit / touchMe 1.11 Folder / scripts / sample 6 < prev    next >
Text File  |  1996-08-08  |  2KB  |  50 lines

  1. -- Sample AppleScripts for touchMe, 1996 (C) Mizutori Tetsuya
  2. -- A droplet to change the date time stamp of every file {in the given folder(s)}
  3. -- that copies its creation date to the modification date by file-by-file.
  4. -- How to compile this AppleScript: execute "Save As Run-Only..." command!
  5. -- Usage1: Run this droplet to select a target folder in the prompt dialog.
  6. -- Usage2: Drag & drop the target folders (or files) onto this droplet icon.
  7.  
  8. -- Thanks to Jim van Zee for encouraging me to write this wonderful script.
  9. -- The Macintosh tar application "suntar 2.0.4" has an optional switch
  10. -- to preserve the modification date, or not, when extracting a tar file.
  11. -- After extracting the files, haven't you ever changed your mind in another
  12. -- way the modification date should be? This sample script can be of a help
  13. -- to you who watnt to copy the creation date to the modification date.
  14.  
  15.  
  16. tell me to open {(choose folder)}
  17. --tell me to open {(choose file)}
  18.  
  19. on open (docList)
  20.     tell application "touchMe"
  21.         activate
  22.         set prefs creation to {enabled:false}
  23.         set prefs modification to {enabled:true, flag:exact}
  24.     end tell
  25.     --
  26.     repeat with theItem in the docList
  27.         if the folder of (info for theItem) is true then
  28.             repeat with theFilename in the list folder theItem
  29.                 tell me to SetDateTimeStamp by (alias ((theItem as string) & theFilename))
  30.             end repeat
  31.         else
  32.             tell me to SetDateTimeStamp by theItem
  33.         end if
  34.     end repeat
  35.     --
  36.     tell application "touchMe"
  37.         quit
  38.     end tell
  39. end open
  40.  
  41. to SetDateTimeStamp by theFile
  42.     tell application "touchMe"
  43.         set theStamp to fetch theFile
  44.         set theDate to the creation date of theStamp
  45.         -- set theDate to the modification date of theStamp
  46.         set prefs modification to {value:theDate}
  47.         touch theFile
  48.     end tell
  49. end SetDateTimeStamp
  50.